package team.seekers.hula.common.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * 消息通知
 */


@Getter
public enum NoticeTypeEnum implements IEnum<Integer> {

    // 发送给用户
    ADD_ANSWER_COMMENT(1,  "回答新增评论"),
    ADD_ANSWER_GOOD(2,  "回答新增点赞"),
    ADD_COMMENT_GOOD(3,"评论新增点赞"),
    ADD_QUESTION_POINT(4,"关注的问题新增观点"),
    COMMENT_SHOW(5,"评论被展示"),// 评论被回答作者回复后展示并推送消息
    QUESTION_FEEDBACK_ACCEPT(6, "问题反馈被采纳"),
    ADD_FOLLOW(7, "新增关注"),


    // 发送给管理员
    ADD_SPECIAL_QUESTION_WAIT(8, "专业提问新增待审核问题"),
    ADD_SPECIAL_POINT_WAIT(9, "专业提问新增待审核观点"),
    ADD_SPECIAL_ANSWER_WAIT(10, "专业提问新增待审核观点"),


    // 发送给问题发出者
    ADD_QUESTION_BACK(11, "请求补充问题背景"),
    ADD_POINT_WAIT(12, "普通提问新增观点待审核");

    private int type;

    private String name;

    NoticeTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static NoticeTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static NoticeTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
